import request from '/@/utils/request';
const modulePath = '/workbench';

// 通知公告列表
export function noticeList(query?: Object) {
	return request({
		url: `${modulePath}/notificationAnnouncement/list`,
		method: 'get',
		params: query,
	});
}
// 通知公告分页
export function noticePage(query?: any) {
	const data = { ...query };
	data.publishBegin = data.publishTime ? data.publishTime[0] : '';
	data.publishEnd = data.publishTime ? data.publishTime[1] : '';
	data.createBegin = data.createTime ? data.createTime[0] : '';
	data.createEnd = data.createTime ? data.createTime[1] : '';
	delete data.publishTime;
	delete data.createTime;
	return request({
		url: `${modulePath}/notificationAnnouncement/page`,
		method: 'post',
		data,
	});
}

// 新增通知公告
export function noticeSave(data?: any) {
	return request({
		url: `${modulePath}/notificationAnnouncement/save`,
		method: 'post',
		data,
	});
}

// 通知公告详情
export function getNnoticeDetail(id: any) {
	return request({
		url: `${modulePath}/notificationAnnouncement/${id}`,
		method: 'get',
	});
}
// 修改通知公告
export function noticeEdit(data?: any) {
	return request({
		url: `${modulePath}/notificationAnnouncement/update`,
		method: 'put',
		data,
	});
}
// 通知公告发布-取消
export function updatePublishStatus(data?: any) {
	return request({
		url: `${modulePath}/notificationAnnouncement/updatePublishStatus`,
		method: 'get',
		params: data,
	});
}
// 通知公告删除
export function delPublish(id?: any) {
	return request({
		url: `${modulePath}/notificationAnnouncement/${id}`,
		method: 'DELETE',
		params: id,
	});
}
